# 在其他服务中调用
from crawler_service.main import crawler_service

# 自定义状态回调
def my_status_callback(task_id: str, status_data: dict):
    # 发送到WebSocket、写入数据库、发送通知等
    print(f"任务状态: {status_data}")

# 设置回调
crawler_service.status_callback = my_status_callback

# 启动爬取
task_id =  crawler_service.start_crawl("科技公司")

# 获取状态
status = crawler_service.get_task_status(task_id)